﻿using System;
using System.Data;
using System.Data.SqlClient;
using NetWing.Common;
using NetWing.Common.Data.SqlServer;

namespace NetWing.BPM.Admin.JydWodrmb
{
    public partial class print_printhjg : System.Web.UI.Page
    {

        protected string myws;
        protected string myxd;
        protected string myxdrq;
        protected string myjhrq;
        protected string mysh;
        protected string yspmco;
        protected string orderid;
        protected string mycc;
        protected string mynum;
        protected string mydj;
        protected string myysf;
        protected string total;
        protected string myzzxm;
        protected string wsjgbz;
        protected string nametle;
        protected string address;
        protected string qrcode;
        protected string ai;
        protected string je;
        protected string manager;
        public DataTable dt = null;
        public DataTable de = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            
            string id = Request["KeyId"];
            string dateii = Request["OrderID"];
            string yspmc = Request["yspmc"];
            if (yspmc == null)
            {
                
                dt = SqlEasy.ExecuteDataTable("select * from jydorderhoujiagong where keyid in("+id+")");

                myws = dt.Rows[0]["myws"].ToString();
                myxd = dt.Rows[0]["myxd"].ToString();
                myxdrq = dt.Rows[0]["adddate"].ToString();
                myjhrq = dt.Rows[0]["myjhrq"].ToString();
                mysh = dt.Rows[0]["mysh"].ToString();
                yspmco = dt.Rows[0]["yspmc"].ToString();
                orderid = dt.Rows[0]["orderid"].ToString();
                mycc = dt.Rows[0]["mycc"].ToString();
                mynum = dt.Rows[0]["mynum"].ToString();
                mydj = dt.Rows[0]["mydj"].ToString();
                myysf = dt.Rows[0]["myysf"].ToString();
                //total = dt.Rows[0]["mytotal"].ToString();
                myzzxm = dt.Rows[0]["myzzxm"].ToString();
                wsjgbz = dt.Rows[0]["wsjgbz"].ToString();
                qrcode = dt.Rows[0]["order_img"].ToString();
                je = dt.Rows[0]["yfprice"].ToString();
                qrcode = ConfigHelper.GetValue("website") + qrcode;
                manager = dt.Rows[0]["manager"].ToString();

                SqlDataReader dr = SqlEasy.ExecuteDataReader("select * from jydUser where  comname='" + myws + "'");
                if (dr.Read())
                {
                    nametle = dr["tell"].ToString();
                    address = dr["address"].ToString();
                    ai = dr["realname"].ToString();
                }
                dr.Close();
            }



            else
            {
            dt = SqlEasy.ExecuteDataTable("select * from jydOrderDetail where  keyid='" + id + "'");

            myws = dt.Rows[0]["myws"].ToString();
            myxd = dt.Rows[0]["myxd"].ToString();
            myxdrq = dt.Rows[0]["myxdrq"].ToString();
            myjhrq = dt.Rows[0]["myjhrq"].ToString();
            mysh = dt.Rows[0]["mysh"].ToString();
            yspmco = dt.Rows[0]["yspmc"].ToString();
            orderid = dt.Rows[0]["orderid"].ToString();
            mycc = dt.Rows[0]["mycc"].ToString();
            mynum = dt.Rows[0]["mynum"].ToString();
            mydj = dt.Rows[0]["mydj"].ToString();
            myysf = dt.Rows[0]["myysf"].ToString();
            total = dt.Rows[0]["mytotal"].ToString();
            myzzxm = dt.Rows[0]["myzzxm"].ToString();
            wsjgbz = dt.Rows[0]["wsjgbz"].ToString();
            qrcode = dt.Rows[0]["order_img"].ToString();
            qrcode = ConfigHelper.GetValue("website") + qrcode;

                SqlDataReader dr = SqlEasy.ExecuteDataReader("select * from jydUser where  comname='" + myws + "'");
            if (dr.Read())
            {
                nametle = dr["tell"].ToString();
                address = dr["address"].ToString();
                    ai = dr["realname"].ToString();
                }
            dr.Close();

            }
            //object str = SqlEasy.ExecuteScalar("select top 1 tell from jydUser where  comname='" + myws + "'");
            //if (str != DBNull.Value)
            //{
            //    nametle = str.ToString();
            //    //str.ToString();
            //}
            //if(!string.IsNullOrEmpty(address = de.Rows[0]["address"].ToString()))
            // {
            //    address = de.Rows[0]["address"].ToString();
            //}


        }
    }
}